<template>
	<view class="activity">
		<view class="item" v-for="(v,i) in list" :key="i" @click="navigateTo(`/pages/index/activityInfo?id=${v.id}`)">
			<view class="title">
				{{v.title}}
			</view>
			<image :src="v.img" mode="widthFix"></image>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				page: 1,
				list:[],
				total:0
			}
		},
		onLoad() {
			this.activityList()
		},
		methods: {
			// 活动列表
			async activityList() {
				let res = await this.$http("api/work/activityList", {
					page: this.page, //true	int		当前页
					size: 10, //true	int		每页多少条
				},"GET")
				// console.log(res);
				if(res.code == 200){
					this.list = this.list.concat(res.result.data)
					this.total = res.result.total
				}
			},
		},
		onReachBottom() {
			if (this.list.length >= this.total) return
			this.page += 1
			this.activityList()
		}
	}
</script>

<style scoped lang="scss">
	page {
		background: #f3f3f3;
	}
	.activity {
		padding: 32rpx;
		.item{
			margin-bottom: 20rpx;
			background: #FFFFFF;
			box-shadow: 0rpx 0rpx 16rpx 0rpx rgba(0, 0, 0, 0.1);
			border-radius: 20rpx 20rpx 20rpx 20rpx;
			padding: 15rpx;
			box-sizing: border-box;
			.title{
				font-weight: bold;
				font-size: 28rpx;
				color: #333333;
				padding: 15rpx 0;
			}
			image{
				display: block;
				width: 100%;
				// height: 292rpx;
			}
		}
	}
</style>